#include<iostream>
using namespace std;
#define ok 0
#define error -1
class SeqList {
private:
	int* list;
	int maxsize;
	int size;
public:
	SeqList();
	~SeqList();
	int list_size();
	int list_insert(int i, int item);
	int list_del(int i);
	int list_get(int i);
	void list_display();
};
SeqList::SeqList() {
	maxsize = 1000;
	size = 0;
	list = new int[maxsize];
}
SeqList::~SeqList() {
	delete[]list;
}
int SeqList::list_size() {
	return size;
}
int SeqList::list_insert(int i, int item) {
	if (i > 0&&i <= size + 1) {
		for (int j = size; j >= i; j--) {
			list[j] = list[j - 1];
		}
		list[i - 1] = item;
		size++;
		return ok;
	}
	else {
		cout << "error" << endl;
		return error;
	}
}
int SeqList::list_del(int i) {
	if (i < 1 || i > size) {
		cout << "error" << endl;
		return error;
	}
	else {
		for (int j = i - 1; j < size - 1; j++) {
			list[j] = list[j + 1];
		}
		size--;
		list_display();
		return ok;
	}
}
int SeqList::list_get(int i) {
	if (i < 1 || i > size) {
		cout << "error";
		return error;
	}
	else {
		cout << list[i - 1];
		return ok;
	}
}
void SeqList::list_display() {
	cout << size << ' ';
	for (int i = 0; i < size; i++) {
		cout << list[i] << ' ';
	}
	cout << endl;
}
int main()
{
	SeqList sl;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int m;
		cin >> m;
		sl.list_insert(i + 1, m);
	}
	sl.list_display();
	int i;
	int m;
	int j;
	cin >> i >> m;
	j = sl.list_insert(i, m);
	if (j != error) {
		sl.list_display();
	}
	cin >> i >> m;
	j = sl.list_insert(i, m);
	if (j != error) {
		sl.list_display();
	}
	cin >> i;
	sl.list_del(i);
	cin >> i;
	sl.list_del(i);
	cin >> i;
	sl.list_get(i);
	cout << endl;
	cin >> i;
	sl.list_get(i);
}